# -*- coding: utf-8 -*-
"""
sklearn中的SVM
Created on Wed Apr 25 15:23:04 2018

@author: Allen
"""

import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets

iris = datasets.load_iris()

X = iris.data
y = iris.target

X = X[y<2,:2]
y = y[y<2]

# 对数据进行归一化处理
from sklearn.preprocessing import StandardScaler
standardScaler = StandardScaler()
standardScaler.fit( X )
X_standard = standardScaler.transform( X )

from sklearn.svm import LinearSVC
svc = LinearSVC( C = 1e9 ) # C越大，容错空间越小；C越小，容错空间越大
svc.fit( X_standard, y )
'''
LinearSVC(C=1000000000.0, class_weight=None, dual=True, fit_intercept=True,
     intercept_scaling=1, loss='squared_hinge', max_iter=1000,
     multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
     verbose=0)
需要注意的是两个参数：
    multi_class = "ovr" 同样还可以使用ovo
    penalty = "l2" 同样可以尝试一下使用l1范数
'''

